home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / k3baudiocdtracksource.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-27  |  2.8 KB  |  100 lines

  1. /* 
  2.  *
  3.  * $Id: k3baudiocdtracksource.h 619556 2007-01-03 17:38:12Z trueg $
  4.  * Copyright (C) 2005 Sebastian Trueg <trueg@k3b.org>
  5.  *
  6.  * This file is part of the K3b project.
  7.  * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  * See the file "COPYING" for the exact licensing terms.
  14.  */
  15.  
  16. #ifndef _K3B_AUDIO_CD_TRACK_SOURCE_H_
  17. #define _K3B_AUDIO_CD_TRACK_SOURCE_H_
  18.  
  19. #include "k3baudiodatasource.h"
  20.  
  21. #include <k3btoc.h>
  22. #include <k3bcddbresult.h>
  23.  
  24. #include "k3b_export.h"
  25.  
  26.  
  27. namespace K3bDevice {
  28.   class Device;
  29. }
  30. class K3bCdparanoiaLib;
  31.  
  32.  
  33. /**
  34.  * Audio data source which reads it's data directly from an audio CD.
  35.  *
  36.  * Be aware that since GUI elements are not allowed in sources (other thread)
  37.  * the source relies on the audio CD being inserted before any read operations.
  38.  * It will search all available devices for the CD starting with the last used drive.
  39.  */
  40. class LIBK3B_EXPORT K3bAudioCdTrackSource : public K3bAudioDataSource
  41. {
  42.  public:
  43.   /**
  44.    * Default constructor to create a new source.
  45.    */
  46.   K3bAudioCdTrackSource( const K3bDevice::Toc& toc, int cdTrackNumber, const K3bCddbResultEntry& cddb, 
  47.              K3bDevice::Device* dev = 0 );
  48.  
  49.   /**
  50.    * Constructor to create sources when loading from a project file without toc information
  51.    */
  52.   K3bAudioCdTrackSource( unsigned int discid, const K3b::Msf& length, int cdTrackNumber, 
  53.              const QString& artist, const QString& title,
  54.              const QString& cdartist, const QString& cdtitle );
  55.   K3bAudioCdTrackSource( const K3bAudioCdTrackSource& );
  56.   ~K3bAudioCdTrackSource();
  57.  
  58.   unsigned int discId() const { return m_discId; }
  59.   int cdTrackNumber() const { return m_cdTrackNumber; }
  60.   const K3bCddbResultEntry& metaInfo() const { return m_cddbEntry; }
  61.  
  62.   K3b::Msf originalLength() const;
  63.   bool seek( const K3b::Msf& );
  64.   int read( char* data, unsigned int max );
  65.   QString type() const;
  66.   QString sourceComment() const;
  67.   K3bAudioDataSource* copy() const;
  68.  
  69.   /**
  70.    * Searches for the corresponding Audio CD and returns the device in which it has
  71.    * been found or 0 if it could not be found.
  72.    */
  73.   K3bDevice::Device* searchForAudioCD() const;
  74.  
  75.   /**
  76.    * Set the device the source should start to look for the CD.
  77.    */
  78.   void setDevice( K3bDevice::Device* dev );
  79.  
  80.  private:
  81.   bool initParanoia();
  82.   void closeParanoia();
  83.   bool searchForAudioCD( K3bDevice::Device* ) const;
  84.  
  85.   unsigned int m_discId;
  86.   K3b::Msf m_length;
  87.   K3bDevice::Toc m_toc;
  88.   int m_cdTrackNumber;
  89.   K3bCddbResultEntry m_cddbEntry;
  90.  
  91.   // ripping
  92.   // we only save the device we last saw the CD in
  93.   K3bDevice::Device* m_lastUsedDevice;
  94.   K3bCdparanoiaLib* m_cdParanoiaLib;
  95.   K3b::Msf m_position;
  96.   bool m_initialized;
  97. };
  98.  
  99. #endif
  100.